You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Cheng Pan (Jira)" <ji...@apache.org> on 2025/10/17 02:47:00 UTC

[jira] [Updated] (SPARK-53149) Fix testing whether BeeLine process run in background

     [ https://issues.apache.org/jira/browse/SPARK-53149?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cheng Pan updated SPARK-53149:
------------------------------
    Summary: Fix testing whether BeeLine process run in background  (was: test of background produces error message)

> Fix testing whether BeeLine process run in background
> -----------------------------------------------------
>
>                 Key: SPARK-53149
>                 URL: https://issues.apache.org/jira/browse/SPARK-53149
>             Project: Spark
>          Issue Type: Bug
>          Components: Windows
>    Affects Versions: 3.5.6, 4.0.0
>            Reporter: Phil Walker
>            Priority: Minor
>              Labels: pull-request-available
>
> script `bin/load-spark-env.sh` tests for whether running in foreground or background by calling `ps -o stat=` and checking output for `+`.    When running in a windows shell environment, this results in an error message to `stdout`.   This is because the `ps.exe` tool in these environments doesn't support the `ps -o stat= -p $$` expression.
>  
> AFAIK, there is no equivalent expression in any of these environments (MSYS2, cygwin64, Git-for-Windows).   However, the error message can be suppressed by redirecting `stderr` to /dev/null, reducing the negative impact.
>  
> Currently, the last section of `bin/load-spark-env.sh` looks like this:
> ```
> if [[ ( ! $(ps -o stat= -p $$) =~ "+" ) && ! ( -p /dev/stdin ) ]]; then
>   export SPARK_BEELINE_OPTS="$SPARK_BEELINE_OPTS -Djline.terminal=jline.UnsupportedTerminal"
> fi
> ```
> The following variation would eliminate the error message:
> ```
> if [[ ( ! $(ps -o stat= -p $$ 2>/dev/null) =~ "+" ) && ! ( -p /dev/stdin ) ]]; then
>   export SPARK_BEELINE_OPTS="$SPARK_BEELINE_OPTS -Djline.terminal=jline.UnsupportedTerminal"
> fi
> ```



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org