nsh: sh_main also support isctty = true
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
963c1f31db
commit
9730eaad9e
@ -214,6 +214,27 @@ int platform_user_verify(FAR const char *username, FAR const char *password);
|
|||||||
|
|
||||||
int nsh_system(int argc, FAR char *argv[]);
|
int nsh_system(int argc, FAR char *argv[]);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nsh_system_ctty
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This is the NSH-specific implementation of the standard system()
|
||||||
|
* command.
|
||||||
|
*
|
||||||
|
* NOTE:
|
||||||
|
* This difference with nsh_system: newconsole set isctty true
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* Standard task start-up arguments. Expects argc == 2 with argv[1] being
|
||||||
|
* the command to execute
|
||||||
|
*
|
||||||
|
* Returned Values:
|
||||||
|
* EXIT_SUCCESS or EXIT_FAILURE
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int nsh_system_ctty(int argc, FAR char *argv[]);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,27 @@
|
|||||||
#include "nsh.h"
|
#include "nsh.h"
|
||||||
#include "nsh_console.h"
|
#include "nsh_console.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Static Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int nsh_system_(int argc, FAR char *argv[], int isctty)
|
||||||
|
{
|
||||||
|
FAR struct console_stdio_s *pstate = nsh_newconsole(isctty);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
DEBUGASSERT(pstate != NULL);
|
||||||
|
|
||||||
|
/* Execute the session */
|
||||||
|
|
||||||
|
ret = nsh_session(pstate, false, argc, argv);
|
||||||
|
|
||||||
|
/* Exit upon return */
|
||||||
|
|
||||||
|
nsh_exit(&pstate->cn_vtbl, ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -57,17 +78,29 @@
|
|||||||
|
|
||||||
int nsh_system(int argc, FAR char *argv[])
|
int nsh_system(int argc, FAR char *argv[])
|
||||||
{
|
{
|
||||||
FAR struct console_stdio_s *pstate = nsh_newconsole(false);
|
return nsh_system_(argc, argv, false);
|
||||||
int ret;
|
}
|
||||||
|
|
||||||
DEBUGASSERT(pstate != NULL);
|
/****************************************************************************
|
||||||
|
* Name: nsh_system_ctty
|
||||||
/* Execute the session */
|
*
|
||||||
|
* Description:
|
||||||
ret = nsh_session(pstate, false, argc, argv);
|
* This is the NSH-specific implementation of the standard system()
|
||||||
|
* command.
|
||||||
/* Exit upon return */
|
*
|
||||||
|
* NOTE:
|
||||||
nsh_exit(&pstate->cn_vtbl, ret);
|
* This difference with nsh_system: newconsole set isctty true
|
||||||
return ret;
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* Standard task start-up arguments. Expects argc == 2 with argv[1] being
|
||||||
|
* the command to execute
|
||||||
|
*
|
||||||
|
* Returned Values:
|
||||||
|
* EXIT_SUCCESS or EXIT_FAILURE
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int nsh_system_ctty(int argc, FAR char *argv[])
|
||||||
|
{
|
||||||
|
return nsh_system_(argc, argv, true);
|
||||||
}
|
}
|
||||||
|
@ -49,5 +49,5 @@ int main(int argc, FAR char *argv[])
|
|||||||
* system() and popen() interfaces.
|
* system() and popen() interfaces.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return nsh_system(argc, argv);
|
return nsh_system_ctty(argc, argv);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user