Skip to content

Commit

Permalink
Fix #945, shell implementation on posix and rtems
Browse files Browse the repository at this point in the history
Due to other changes the shell implementation on RTEMS and POSIX failed
to build under certain configurations.  This fixes and verifies the
shell functions as expected.
  • Loading branch information
jphickey committed Apr 6, 2021
1 parent 65c584f commit f9d571a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 102 deletions.
10 changes: 2 additions & 8 deletions src/os/posix/src/os-impl-shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "os-posix.h"
#include "os-impl-io.h"

#include "os-shared-file.h"
#include "os-shared-shell.h"
#include "os-shared-idmap.h"

Expand All @@ -60,7 +61,6 @@
int32 OS_ShellOutputToFile_Impl(const OS_object_token_t *token, const char *Cmd)
{
pid_t cpid;
uint32 local_id;
int wstat;
const char * shell = getenv("SHELL");
OS_impl_file_internal_record_t *impl;
Expand All @@ -86,13 +86,7 @@ int32 OS_ShellOutputToFile_Impl(const OS_object_token_t *token, const char *Cmd)
dup2(impl->fd, STDERR_FILENO);

/* close all _other_ filehandles */
for (local_id = 0; local_id < OS_MAX_NUM_OPEN_FILES; ++local_id)
{
if (OS_global_stream_table[local_id].active_id != 0)
{
close(OS_impl_filehandle_table[local_id].fd);
}
}
OS_CloseAllFiles();

execl(shell, "sh", "-c", Cmd, NULL); /* does not return if successful */
exit(EXIT_FAILURE);
Expand Down
13 changes: 4 additions & 9 deletions src/os/rtems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,10 @@ set(RTEMS_IMPL_SRCLIST
../portable/os-impl-posix-dirs.c
)

if (OSAL_CONFIG_INCLUDE_SHELL)
list(APPEND RTEMS_IMPL_SRCLIST
src/os-impl-shell.c
)
else ()
list(APPEND RTEMS_IMPL_SRCLIST
../portable/os-impl-no-shell.c
)
endif ()
# Currently the "shell output to file" for RTEMS is not implemented
list(APPEND RTEMS_IMPL_SRCLIST
../portable/os-impl-no-shell.c
)

# If some form of module loading is configured,
# then build the module loader
Expand Down
85 changes: 0 additions & 85 deletions src/os/rtems/src/os-impl-shell.c

This file was deleted.

0 comments on commit f9d571a

Please sign in to comment.