Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #887, specify shell name in ShellOutputToFile #938

Merged
merged 1 commit into from
Apr 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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