|
@ -187,10 +187,10 @@ public class CellularNetworkService : ICellularNetworkService |
|
|
{ |
|
|
{ |
|
|
if (command.CanBeKilled) |
|
|
if (command.CanBeKilled) |
|
|
{ |
|
|
{ |
|
|
await KillProcessAsync(command.Template); |
|
|
await KillProcessAsync(command.Template, command.Timeout); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var result = await _commandExecutor.ExecuteCommandAsync(command.Template, _context.token); |
|
|
var result = await _commandExecutor.ExecuteCommandAsync(command.Template, new CancellationTokenSource(),command.Timeout); |
|
|
return result.IsSuccess; |
|
|
return result.IsSuccess; |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
@ -200,7 +200,7 @@ public class CellularNetworkService : ICellularNetworkService |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async Task KillProcessAsync(string template) |
|
|
private async Task KillProcessAsync(string template,int Timeout) |
|
|
{ |
|
|
{ |
|
|
string killCmd = $"ps -ef | grep {template} | grep -v grep | awk '{{print $2}}' | xargs kill -9"; |
|
|
string killCmd = $"ps -ef | grep {template} | grep -v grep | awk '{{print $2}}' | xargs kill -9"; |
|
|
await _commandExecutor.ExecuteCommandAsync(killCmd, new CancellationTokenSource()); |
|
|
await _commandExecutor.ExecuteCommandAsync(killCmd, new CancellationTokenSource()); |
|
|