Closed corto25 closed 2 days ago
I can't replicate this, it works exactly as it should.
Ah sorry, I didn't see the extra \"
quotes you were mentioning, my bad.
Definitely a bug in Kong. I think what's happening is that it isn't unquoting the internal JSON value correctly before splitting.
Actually, nope sorry, I can't replicate it. I actually had an incorrect test case.
https://go.dev/play/p/2DzOikBF5o8 <- this works exactly as expected.
If you can provide a minimal runnable reproduction case, I'll take a look.
I've noticed the
os.Args
may be at fault and this is likely not a kong issue. Try printinglog.Printf("Args: %#v", os.Args)
:Args: []string{"./build/missionctl.x86_64", "build", "--root", "/home/simon/projects/foo", "--cmds=make", "-j8", "build/bar;mv", "-v", "{build,/tmp}/bar"}
If this is the case, it definitely isn't a problem with Kong - there's something weird going on with your shell.
With the following struct:
And passing the following program arguments:
Or this variant program arguments (both produce the same unexpected results):
Expectation is to get the equivalent of the following go assignments:
The actual behavior is a parse error:
I can't find a workaround: tried
--cmds "make\ -j8\ build"
, tried--cmds "make\ \-j8\ build"
, tried--cmds 'make -j8 build'
, etc...Affected versions: kong v0.8.0 and v0.9.0, go1.22.3
Root cause?
I've noticed the
os.Args
may be at fault and this is likely not a kong issue. Try printinglog.Printf("Args: %#v", os.Args)
:Since kong is adversely affected by this, so perhaps we can work together to find a suitable workaround.
My expectation is to get the same as this C++ program achieves:
Build with:
Execute with the most awkward, yet most likely usage of the kong CLI:
Yields the following:
Note the Arg[3] was expanded by the shell and Arg[4] was modified to remove the double-quotes within yet retain the whole thing as a single argument. My shell is bash.