diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2016-12-27 16:46:08 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2016-12-27 16:46:08 +0900 |
commit | db20f3f1bb8595633a7e16c8900fd401a453a6b5 (patch) | |
tree | e5435159cd1bf0519276363a6fe1663d1721bed3 /src/pal/tests/palsuite/threading/CreateProcessW/test2/childprocess.cpp | |
parent | 4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (diff) | |
download | coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.gz coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.bz2 coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.zip |
Imported Upstream version 1.0.0.9127upstream/1.0.0.9127
Diffstat (limited to 'src/pal/tests/palsuite/threading/CreateProcessW/test2/childprocess.cpp')
-rw-r--r-- | src/pal/tests/palsuite/threading/CreateProcessW/test2/childprocess.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/threading/CreateProcessW/test2/childprocess.cpp b/src/pal/tests/palsuite/threading/CreateProcessW/test2/childprocess.cpp new file mode 100644 index 0000000000..b4ab9366d9 --- /dev/null +++ b/src/pal/tests/palsuite/threading/CreateProcessW/test2/childprocess.cpp @@ -0,0 +1,78 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/*============================================================ +** +** Source: createprocessw/test2/childprocess.c +** +** Purpose: This child process reads a string from stdin +** and writes it out to stdout & stderr +** +** Dependencies: memset +** fgets +** gputs +** + +** +**=========================================================*/ + +#define UNICODE +#include <palsuite.h> +#include "test2.h" + + +int __cdecl main( int argc, char **argv ) +{ + int iRetCode = EXIT_OK_CODE; /* preset exit code to OK */ + char szBuf[BUF_LEN]; + + WCHAR *swzParam1, *swzParam2, *swzParam3 = NULL; + + + if(0 != (PAL_Initialize(argc, argv))) + { + return FAIL; + } + if (argc != 4) + { + return EXIT_ERR_CODE3; + } + + swzParam1 = convert(argv[1]); + swzParam2 = convert(argv[2]); + swzParam3 = convert(argv[3]); + + if (wcscmp(swzParam1, szArg1) != 0 + || wcscmp(swzParam2, szArg2) != 0 + || wcscmp(swzParam3, szArg3) != 0) + { + return EXIT_ERR_CODE4; + } + + free(swzParam1); + free(swzParam2); + free(swzParam3); + + memset(szBuf, 0, BUF_LEN); + + /* Read the string that was written by the parent */ + if (fgets(szBuf, BUF_LEN, stdin) == NULL) + { + return EXIT_ERR_CODE1; + } + + + /* Write the string out to the stdout & stderr pipes */ + if (fputs(szBuf, stdout) == EOF + || fputs(szBuf, stderr) == EOF) + { + return EXIT_ERR_CODE2; + } + + /* The exit code will indicate success or failure */ + PAL_TerminateEx(iRetCode); + + /* Return special exit code to indicate success or failure */ + return iRetCode; +} |