1

Case

I am deploying a software product using Wpkg over Windows workstations. I need to disable product's faulty automatic update and the best solution in this case is to modify one configuration file with a following regular expression: s/<value>.*<\/value>/<value>file:\\\\<\/value>/g

Problem

To perform the described task, I use SED:

%BASH%\sed "s/<value>.*<\/value>/<value>file:\\\\<\/value>/g" "MyApp.config" > "MyApp.config.tmp"`

Whenever I do it from commandline, it works.

But once I paste it into Wpkg (<> escaped due to XML constraints):

<install cmd='%BASH%\sed "s/&lt;value&gt;.*&lt;\/value&gt;/&lt;value&gt;file:\\\\&lt;\/value&gt;/g" "%PKG_DESTINATION%\MyApp.config" &gt; "%PKG_DESTINATION%\MyApp.config.tmp"' />

...it fails, creating no new files and... returning mysterious error code 2:

Exit code returned non-successful value (2) on command '%BASH%\sed "s/<value>.*<
\/value>/<value>file:\\\\<\/value>/g" "%PKG_DESTINATION%\MyApp.config" > "%PKG_D
ESTINATION%\MyApp.config.tmp"'.

Question

After a pointless hour and half of searching for that mysterious error code 2 I begin to believe that there is either something wrong in me vs. Google relationship, or there really is no documentation for that error. Official manual also left me blind.

I've tried to dump stderr of that Wpkg command to text file, but the file ain't being created, which suggests no stderr to dump.

Perhaps a second or third pair of eyes would help me find the source of the problem?

  • Could you indicate if this is still an issue? Have you considered to use PowerShell? – 030 Aug 16 '15 at 09:08

1 Answers1

0

Apparently, the error 2 was returned not by the sed command, but by the Wpkg being unable to find the %BASH%\sed.exe file :)