This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -697,6 +697,18 @@ public static NPath CreateTempDirectory(string myprefix)
697
697
}
698
698
}
699
699
700
+ public static NPath GetTempFilename ( string myprefix = "" )
701
+ {
702
+ var random = new Random ( ) ;
703
+ var prefix = FileSystem . GetTempPath ( ) + "/" + ( String . IsNullOrEmpty ( myprefix ) ? "" : myprefix + "_" ) ;
704
+ while ( true )
705
+ {
706
+ var candidate = new NPath ( prefix + random . Next ( ) ) ;
707
+ if ( ! candidate . Exists ( ) )
708
+ return candidate ;
709
+ }
710
+ }
711
+
700
712
public NPath Move ( string dest )
701
713
{
702
714
return Move ( new NPath ( dest ) ) ;
Original file line number Diff line number Diff line change @@ -76,7 +76,8 @@ public void RunCommandLineWindow(NPath workingDirectory)
76
76
{
77
77
// we need to create a temp bash script to set up the environment properly, because
78
78
// osx terminal app doesn't inherit the PATH env var and there's no way to pass it in
79
- var envVarFile = environment . FileSystem . GetRandomFileName ( ) ;
79
+
80
+ var envVarFile = NPath . GetTempFilename ( ) ;
80
81
environment . FileSystem . WriteAllLines ( envVarFile , new string [ ] { "cd $GHU_WORKINGDIR" , "PATH=$GHU_FULLPATH:$PATH /bin/bash" } ) ;
81
82
Mono . Unix . Native . Syscall . chmod ( envVarFile , ( Mono . Unix . Native . FilePermissions ) 493 ) ; // -rwxr-xr-x mode (0755)
82
83
startInfo . FileName = "open" ;
You can’t perform that action at this time.
0 commit comments