Skip to content

Commit

Permalink
Merge pull request #938 from jphickey/fix-887-shelloutput
Browse files Browse the repository at this point in the history
Fix #887, specify shell name in ShellOutputToFile
  • Loading branch information
astrogeco authored Apr 8, 2021
2 parents 39c1bcf + 7215989 commit 7746955
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/os/vxworks/src/os-impl-shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "os-impl-io.h"
#include "os-shared-shell.h"
#include "os-shared-file.h"
#include "os-shared-task.h"
#include "os-shared-idmap.h"
#include "os-shared-common.h"

Expand All @@ -59,10 +60,12 @@ int32 OS_ShellOutputToFile_Impl(const OS_object_token_t *token, const char *Cmd)
int32 ReturnCode = OS_ERROR;
int32 Result;
osal_id_t fdCmd;
char * shellName;
OS_impl_file_internal_record_t *out_impl;
OS_impl_file_internal_record_t *cmd_impl;
OS_object_token_t cmd_token;
char localShellName[OS_MAX_API_NAME];

snprintf(localShellName, sizeof(localShellName), "shll_%08lx", OS_ObjectIdToInteger(OS_TaskGetId()));

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

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

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

ReturnCode = OS_SUCCESS;
}
Expand Down

0 comments on commit 7746955

Please sign in to comment.