Skip to content

Commit

Permalink
fixed: Remoty: execute remote execute with arguments should now be wo…
Browse files Browse the repository at this point in the history
…rking
  • Loading branch information
eranif committed Mar 23, 2022
1 parent 13a20c2 commit 0fe6f00
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions Remoty/RemotyWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,19 +774,23 @@ void RemotyWorkspace::OnRun(clExecuteEvent& event)
::wxMessageBox(_("Please specify an executable to run"), "CodeLite", wxICON_ERROR | wxOK | wxOK_DEFAULT);
return;
}

// the main command to run
::WrapWithQuotes(command);
command << " ";
auto argsArr = ::wxStringTokenize(conf->GetArgs(), "\n\r", wxTOKEN_STRTOK);
if(argsArr.size() == 1) {
command << conf->GetArgs();
} else {
// one line per arg
for(auto& line : argsArr) {
line.Trim().Trim(false);
::WrapWithQuotes(line);
command << line << " ";
}

wxString args = conf->GetArgs();
args.Replace("\r", wxEmptyString);
args.Replace("\n", " ");
auto args_arr = StringUtils::BuildArgv(args);

// append the args
for(auto& arg : args_arr) {
arg.Trim().Trim(false);
// wrap with quotes if required
::WrapWithQuotes(arg);
command << " " << arg;
}

wxString envString = CreateEnvScriptContent();
wxString wd = conf->GetWorkingDirectory();
wd.Trim().Trim(false);
Expand All @@ -800,7 +804,7 @@ void RemotyWorkspace::OnRun(clExecuteEvent& event)
scriptContent << "cd " << wd << "\n";

command.Trim().Trim(false);
scriptContent << ::WrapWithQuotes(command) << "\n";
scriptContent << command << "\n";
scriptContent << "exit $?";

wxString script_path = UploadScript(scriptContent);
Expand Down

0 comments on commit 0fe6f00

Please sign in to comment.