mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Code quality changes for stability and reduced memory usage.
This commit is contained in:
parent
eb042dca58
commit
08216b09c0
21 changed files with 342 additions and 316 deletions
|
@ -128,23 +128,24 @@ namespace ExternalCommand {
|
|||
string arguments = config.arguments[commando];
|
||||
output = null;
|
||||
if (commandline != null && commandline.Length > 0) {
|
||||
Process p = new Process();
|
||||
p.StartInfo.FileName = commandline;
|
||||
p.StartInfo.Arguments = String.Format(arguments, fullPath);
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
if (verb != null) {
|
||||
p.StartInfo.Verb = verb;
|
||||
using (Process p = new Process()) {
|
||||
p.StartInfo.FileName = commandline;
|
||||
p.StartInfo.Arguments = String.Format(arguments, fullPath);
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
if (verb != null) {
|
||||
p.StartInfo.Verb = verb;
|
||||
}
|
||||
LOG.Info("Starting : " + p.StartInfo.FileName + " " + p.StartInfo.Arguments);
|
||||
p.Start();
|
||||
p.WaitForExit();
|
||||
output = p.StandardOutput.ReadToEnd();
|
||||
if (output != null && output.Trim().Length > 0) {
|
||||
LOG.Info("Output:\n" + output);
|
||||
}
|
||||
LOG.Info("Finished : " + p.StartInfo.FileName + " " + p.StartInfo.Arguments);
|
||||
return p.ExitCode;
|
||||
}
|
||||
LOG.Info("Starting : " + p.StartInfo.FileName + " " + p.StartInfo.Arguments);
|
||||
p.Start();
|
||||
p.WaitForExit();
|
||||
output = p.StandardOutput.ReadToEnd();
|
||||
if (output != null && output.Trim().Length > 0) {
|
||||
LOG.Info("Output:\n" + output);
|
||||
}
|
||||
LOG.Info("Finished : " + p.StartInfo.FileName + " " + p.StartInfo.Arguments);
|
||||
return p.ExitCode;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue