mojohaus / mojohaus/exec-maven-plugin

Problem when running plink.exe with '<'

Open
#23 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
191
Forks
111
Avg merge
1d 21h
Merged PRs (30d)
4

Description

Sorry, I could not find the root cause, so I tell you my use case:

PLINK is an SSH client for windows
If I run it from the command line, it works like a charm:

plink.exe myuser@myhost -T -ssh -2 $SHELL /dev /stdin 'a b c d' < test.sh
Output:
execution parameters: a b c d

My test.sh:

#!/bin/bash
echo "execution parameters: $@"

But if I put that into exec:exec, it fails:

[DEBUG] Executing command line: [c:\apps\putty\plink.exe, myuser@myhost, -T, -ssh, -2,
$SHELL, /dev/stdin, a b c d, <, test.sh]
bash: test.sh: No such file or directory
[INFO] ------------------------------------------------------------------------

pom.xml:

<plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>exec-maven-plugin</artifactId> 
     <version>1.4.0</version> 
     <executions> 
          <execution>
                <id>test</id>
                <phase>pre-integration-test</phase>
                <goals>
                     <goal>exec</goal>
                </goals>
                <configuration>
                      <executable>c:\apps\putty\plink.exe</executable>
                      <commandlineArgs>myuser@myhost -T -ssh -2 $SHELL /dev/stdin 'a b c d' &lt; test.sh"</commandlineArgs>
                </configuration>
           </execution>
    </executions> 
</plugin>

My test.sh:

#!/bin/bash
echo "execution parameters: $@"

It does not work regardless the path I put test.sh.
It seems that exec:exec messes up the execution path somehow...

If I execute a .bat file: it passes '< test.sh' correctly.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Windows PLINK invocation from the pom.xml configuration using test.sh, then compare it with the direct command-line behavior. Trace how exec:exec handles the commandlineArgs redirection and quoting; done means the reported invocation behaves consistently with the direct PLINK command or the limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, shell
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.