Skip to content

Commit 7746955

Browse files
authored
Merge pull request #938 from jphickey/fix-887-shelloutput
Fix #887, specify shell name in ShellOutputToFile
2 parents 39c1bcf + 7215989 commit 7746955

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/os/vxworks/src/os-impl-shell.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "os-impl-io.h"
3434
#include "os-shared-shell.h"
3535
#include "os-shared-file.h"
36+
#include "os-shared-task.h"
3637
#include "os-shared-idmap.h"
3738
#include "os-shared-common.h"
3839

@@ -59,10 +60,12 @@ int32 OS_ShellOutputToFile_Impl(const OS_object_token_t *token, const char *Cmd)
5960
int32 ReturnCode = OS_ERROR;
6061
int32 Result;
6162
osal_id_t fdCmd;
62-
char * shellName;
6363
OS_impl_file_internal_record_t *out_impl;
6464
OS_impl_file_internal_record_t *cmd_impl;
6565
OS_object_token_t cmd_token;
66+
char localShellName[OS_MAX_API_NAME];
67+
68+
snprintf(localShellName, sizeof(localShellName), "shll_%08lx", OS_ObjectIdToInteger(OS_TaskGetId()));
6669

6770
/* Create a file to write the command to (or write over the old one) */
6871
Result =
@@ -83,7 +86,7 @@ int32 OS_ShellOutputToFile_Impl(const OS_object_token_t *token, const char *Cmd)
8386
OS_lseek(fdCmd, 0, OS_SEEK_SET);
8487

8588
/* Create a shell task the will run the command in the file, push output to OS_fd */
86-
Result = shellGenericInit("INTERPRETER=Cmd", 0, NULL, &shellName, false, false, cmd_impl->fd, out_impl->fd,
89+
Result = shellGenericInit("INTERPRETER=Cmd", 0, localShellName, NULL, false, false, cmd_impl->fd, out_impl->fd,
8790
out_impl->fd);
8891
}
8992

@@ -93,7 +96,7 @@ int32 OS_ShellOutputToFile_Impl(const OS_object_token_t *token, const char *Cmd)
9396
do
9497
{
9598
taskDelay(sysClkRateGet());
96-
} while (taskNameToId(shellName) != ((TASK_ID)ERROR));
99+
} while (taskNameToId(localShellName) != ((TASK_ID)ERROR));
97100

98101
ReturnCode = OS_SUCCESS;
99102
}

0 commit comments

Comments
 (0)