Closed sourishkrout closed 3 weeks ago
PS: Interestingly this is already fixed in
v2alpha1
and the code in this PR is exclusively forv1
.
It's because shellscript
was added to the interpreterByLanguageID
map. I think it's still worth to add a test in internal/command/command_file_test.go
:
--- a/internal/command/command_file_test.go
+++ b/internal/command/command_file_test.go
@@ -27,6 +27,20 @@ func TestFileCommand(t *testing.T) {
testExecuteCommand(t, cfg, nil, "test", "")
})
+ t.Run("Shellscript", func(t *testing.T) {
+ t.Parallel()
+
+ cfg := &ProgramConfig{
+ LanguageId: "shellscript",
+ Source: &runnerv2alpha1.ProgramConfig_Script{
+ Script: `echo "run this as shell script"`,
+ },
+ Mode: runnerv2alpha1.CommandMode_COMMAND_MODE_FILE,
+ }
+
+ testExecuteCommand(t, cfg, nil, "run this as shell scripta\n", "")
+ })
+
t.Run("Python", func(t *testing.T) {
t.Parallel()
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
In the extension when the
languageID
set toshellscript
, it's being rewritten tosh
. However, only after serialization following the initial deserialization. To deal with this edge-case let's be sure we runshellscript
as such. Prior to this fix it would default tocat
(shebang++) which is wrong.PS: Interestingly this is already fixed in
v2alpha1
and the code in this PR is exclusively forv1
.