I’m stuck on Stage #IP1.
I’ve managed to run the external command but the outpout does not match the expected outpout. I’ve looked at some code examples and even though I have the same implementation as them I can’t seem to pass the test.
Here are my logs:
[tester::#IP1] Running tests for Stage #IP1 (Run a program)
[tester::#IP1] Running ./your_shell.sh
[your-program] $
[tester::#IP1] > my_exe James
[your-program] Hello james! The secret code is 401453.
[tester::#IP1] Expected output to match "Hello James! The secret code is 401453.\n", got "Hello james! The secret code is 401453.\r\n"
[tester::#IP1] condition not met
[tester::#IP1] Test failed
And here’s a snippet of my code:
func startRepl() error {
commands := getCommands()
reader := bufio.NewScanner(os.Stdin)
printPrompt()
for reader.Scan() {
text := cleanInput(reader.Text())
spltText := strings.Split(text, " ")
if command, exists := commands[spltText[0]]; exists {
err := command.Callback(spltText[1:]...)
if err != nil {
return fmt.Errorf("error running command err: %w", err)
}
} else {
if file, err := handleEnviromentVariablePaths(spltText[0]); err == nil {
cmd := exec.Command(file, spltText[1:]...)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
if err := cmd.Run(); err != nil {
return fmt.Errorf("error running external command err: %w", err)
}
} else {
fmt.Printf("%s: command not found\n", spltText[0])
}
}
}
return nil
}