File tree Expand file tree Collapse file tree
ST.Client.Desktop.Linux/Services/Implementation
ST.Client.Desktop.Mac/Internals Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ public async void SystemHibernate(int waitSecond = 30)
185185 await Task . Delay ( waitSecond ) ;
186186 RunShell ( $ "echo \" { SystemUserPassword } \" | sudo sh -c \" echo disk > /sys/pwoer/state\" ") ;
187187 }
188- private string RunShell ( string shell , bool isAdmin = false )
188+ private string RunShell ( string shell )
189189 {
190190 try
191191 {
@@ -226,7 +226,7 @@ public async void TryGetSystemUserPassword(sbyte retry_count = 4)
226226 var pwd = await TextBoxWindowViewModel . ShowDialogAsync ( vm ) ;
227227 if ( ! string . IsNullOrWhiteSpace ( pwd ) )
228228 {
229- if ( ! string . IsNullOrWhiteSpace ( RunShell ( $ "echo \" { pwd } \" | sudo -S sh -c \" sudo -n true\" ", true ) ) )
229+ if ( ! string . IsNullOrWhiteSpace ( RunShell ( $ "echo \" { pwd } \" | sudo -S sh -c \" sudo -n true\" ") ) )
230230 {
231231 SystemUserPassword = pwd ;
232232 }
Original file line number Diff line number Diff line change @@ -98,15 +98,19 @@ public static string RunShell(string shell)
9898 try
9999 {
100100 using var p = new Process ( ) ;
101- p . StartInfo . FileName = BinBash ;
102- p . StartInfo . Arguments = shell ;
101+ p . StartInfo . FileName = UnixHelper . BinBash ;
102+ p . StartInfo . Arguments = "" ;
103103 p . StartInfo . RedirectStandardOutput = true ;
104+ p . StartInfo . RedirectStandardInput = true ;
104105 p . StartInfo . UseShellExecute = false ;
105- p . StartInfo . CreateNoWindow = true ;
106106 p . Start ( ) ;
107+ p . StandardInput . WriteLine ( shell ) ;
108+ p . StandardInput . Close ( ) ;
107109 string result = p . StandardOutput . ReadToEnd ( ) ;
110+ p . StandardOutput . Close ( ) ;
108111 p . WaitForExit ( ) ;
109112 p . Close ( ) ;
113+ p . Dispose ( ) ;
110114 return result ;
111115 }
112116 catch ( Exception e )
You can’t perform that action at this time.
0 commit comments