Skip to content

Conversation

@mcruzdev
Copy link
Contributor

@mcruzdev mcruzdev commented Oct 23, 2025

Context

Implement RunTask.shell task:

document:
  dsl: '1.0.1'
  namespace: test
  name: run-shell-example
  version: '0.1.0'
do:
  - runShell:
      run:
        shell:
          command: 'echo "Hello, ${ .user.name }"'

Tracking

Closes #892

@mcruzdev
Copy link
Contributor Author

mcruzdev commented Oct 23, 2025

@ricardozanini could you share with me a example of arguments? Should be something similar to:

document:
  dsl: '1.0.1'
  namespace: test
  name: run-shell-example
  version: '0.1.0'
do:
  - runShell:
      run:
        shell:
          command: 'kubectl'
          arguments:
            - 'apply'
            - '-f'
            - '/k8s'

And the output should be:

kubectl apply -f /k8s

I am assuming that arguments is a list.

@fjtirado
Copy link
Collaborator

@mcruzdev This has to wait to #899, then you can rebase and move forward

@fjtirado
Copy link
Collaborator

@mcruzdev I have merged #900, please rebase and continue from there, thanks

@mcruzdev
Copy link
Contributor Author

Great @fjtirado, nice abstractions ;)

@ricardozanini
Copy link
Member

@mcruzdev yes, the arguments are a list: https://github.com/serverlessworkflow/specification/blob/main/dsl-reference.md#shell-process

Which kind of example do you need?

@mcruzdev
Copy link
Contributor Author

mcruzdev commented Oct 23, 2025

@mcruzdev yes, the arguments are a list: https://github.com/serverlessworkflow/specification/blob/main/dsl-reference.md#shell-process

Which kind of example do you need?

Ok, it is all, I think I do not need a example 😄

I had a confusion due to map as type of arguments in the documentation.

@ricardozanini
Copy link
Member

@mcruzdev yes, the arguments are a list: https://github.com/serverlessworkflow/specification/blob/main/dsl-reference.md#shell-process
Which kind of example do you need?

Ok, it is all, I think I do not need a example 😄

I had a confusion due to map as type of arguments in the documentation.

You can do:

arguments:
  - key: value

Maybe in some use cases that would make sense.

@mcruzdev mcruzdev changed the title [DRAFT] Add RunTask.shell task Add RunTask.shell task Oct 23, 2025
@mcruzdev
Copy link
Contributor Author

mcruzdev commented Oct 23, 2025

@mcruzdev yes, the arguments are a list: https://github.com/serverlessworkflow/specification/blob/main/dsl-reference.md#shell-process
Which kind of example do you need?

Ok, it is all, I think I do not need a example 😄
I had a confusion due to map as type of arguments in the documentation.

You can do:

arguments:
  - key: value

Maybe in some use cases that would make sense.

It is not clear to me again @ricardozanini, what is the real command statement in that case? The arguments will be used like an input (like script does)? Or we will have something like customcommand key=value or customcommand key=value in the statement.

Comment on lines 121 to 122
StringBuilder stdout = new StringBuilder();
StringBuilder stderr = new StringBuilder();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Althour the override of outputstream is quite imaginative and I like it, I have to mention that is better to use standard library, using


StringWriter outWriter = new StringWriter();
process.getInputStream().transferTo(new OutputStreamWriter(outWriter));

.....

outWriter.toString();

Copy link
Contributor Author

@mcruzdev mcruzdev Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the OutputStreamWriter is not possible, but yes, we need a better solution that is not a byte to byte.

EDIT: I mean in the transferTo method.

Copy link
Collaborator

@fjtirado fjtirado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!
Just minor comments, except the error one.

@mcruzdev mcruzdev marked this pull request as ready for review October 23, 2025 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Shell process implementation

3 participants