Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd runner not working as expected #912

Closed
GideonWolfe opened this issue Jun 1, 2020 · 6 comments
Closed

cmd runner not working as expected #912

GideonWolfe opened this issue Jun 1, 2020 · 6 comments

Comments

@GideonWolfe
Copy link

What's broken?

I have tried a couple times to incorporate commands I run in the terminal to cmdrunner widgets without success.

  1. First example, iponmap. iponmap takes a list of IP addresses and displays them on a map in the terminal.

I have a script that goes

curl -s 'http://some.site/api...' | jq 'some json parsing' | iponmap

jfmap

When I try to run this script from a cmdrunner widget, the widget is simply blank, no errors or anything.

  1. ghcal prints a text representation of your github contributions into the terminal. When I run ghcal --no-ansi in my shell, I get
╔═══════════════════════════════════════════════════════════════════════════════════════════════╗
║        Aug       Sep     Oct     Nov       Dec     Jan     Feb       Mar     Apr     May      ║
║Sun   ⬚ ▤ ▤ ▢ ⬚ ⬚ ▢ ⬚ ⬚ ▢ ⬚ ▢ ▢ ▢ ⬚ ⬚ ⬚ ▢ ▢ ⬚ ⬚ ⬚ ⬚ ⬚ ▤ ▢ ▢ ▢ ⬚ ▢ ▢ ⬚ ⬚ ⬚ ⬚ ▢ ⬚ ⬚ ◼ ▢ ▣ ⬚ ⬚ ▢ ▢║
║Mon   ⬚ ▢ ⬚ ⬚ ⬚ ▢ ▢ ▢ ⬚ ▢ ⬚ ◼ ⬚ ▢ ⬚ ⬚ ▢ ▢ ⬚ ▢ ⬚ ⬚ ⬚ ⬚ ▣ ▢ ▢ ⬚ ▢ ▢ ⬚ ⬚ ⬚ ⬚ ⬚ ▢ ▤ ▢ ▣ ▢ ▢ ⬚ ⬚ ⬚ ▢║
║Tue   ⬚ ▢ ▢ ▢ ▢ ▢ ⬚ ⬚ ⬚ ⬚ ▢ ◼ ⬚ ▢ ▢ ⬚ ⬚ ▢ ⬚ ▢ ▢ ▢ ⬚ ⬚ ⬚ ▢ ▢ ▢ ⬚ ▢ ⬚ ▢ ⬚ ⬚ ▢ ▢ ▤ ⬚ ▢ ▤ ⬚ ▢ ▢ ⬚ ⬚║
║Wed   ▢ ⬚ ⬚ ▢ ▢ ⬚ ⬚ ⬚ ⬚ ▢ ⬚ ▤ ▢ ⬚ ⬚ ▢ ⬚ ⬚ ▢ ▢ ▢ ⬚ ⬚ ▢ ▢ ▢ ▢ ⬚ ⬚ ▢ ⬚ ⬚ ▢ ⬚ ▢ ▢ ◼ ⬚ ▤ ▢ ▢ ⬚ ⬚ ⬚ ▢║
║Thu   ▢ ▢ ⬚ ▢ ⬚ ▢ ⬚ ⬚ ⬚ ▢ ▢ ▣ ▢ ⬚ ⬚ ⬚ ▢ ⬚ ⬚ ▢ ⬚ ▢ ▢ ▢ ▢ ⬚ ▢ ▢ ▢ ▢ ▢ ⬚ ⬚ ⬚ ▢ ▢ ▢ ▣ ▢ ▢ ▤ ▢ ▢ ⬚ ▢║
║Fri   ▢ ⬚ ▢ ⬚ ⬚ ▢ ⬚ ⬚ ▢ ▢ ▢ ⬚ ▢ ⬚ ⬚ ⬚ ▢ ▢ ▢ ⬚ ⬚ ▢ ⬚ ▤ ▢ ⬚ ⬚ ⬚ ⬚ ▢ ⬚ ⬚ ⬚ ⬚ ▢ ▢ ⬚ ▢ ▢ ▤ ⬚ ▢ ⬚ ▢ ▢║
║Sat   ▣ ⬚ ▢ ⬚ ⬚ ⬚ ⬚ ⬚ ▢ ⬚ ⬚ ▢ ▢ ▢ ▢ ▢ ▢ ▢ ▢ ⬚ ⬚ ⬚ ⬚ ▢ ⬚ ⬚ ⬚ ▢ ⬚ ⬚ ⬚ ⬚ ⬚ ▢ ⬚ ⬚ ⬚ ⬚ ▢ ▢ ⬚ ⬚ ▢ ▢ ▢║
║* * *                                                                                          ║
║Commits in Jul 21, 2019 – May 30, 2020: 782                                                    ║
║Longest Streak: 16 days                                                                        ║
║Current Streak: 4 days                                                                         ║
║Max a day: 56                                                                                  ║
╚═══════════════════════════════════════════════════════════════════════════════════════════════╝

But when I try to run this command in a wtf cmdrunner, the window just says "exit status 1", which I have never gotten from just running the command.

Here is how I am trying to launch it

wtf:
  colors:
    background: black
    border:
      focusable: darkslateblue
      focused: blue
      normal: gray
    checked: yellow
    highlight: 
      fore: black
      back: gray
    rows:
      even: yellow
      odd: white
  grid:
    columns: [33, 33, 33]
    rows: [20, 20, 20, 20, 20, 20, 20, 20]
  refreshInterval: 1
  
  mods:
    githubcal:
      type: cmdrunner
      args: ["--no-ansi"]
      cmd: "ghcal"
      enabled: true
      position:
        top: 0
        left: 0
        height: 2
        width: 3
      refreshinterval: 30
      title: "🤖 Tech"
@senorprogrammer
Copy link
Collaborator

Without seeing your shell script I can't know what's going on there, but with the ghcal example, that also fails in this very simple version: https://gist.github.com/senorprogrammer/5ae02f3bd39ab4bd5e3415cfc1802c6c

Something about ghcal isn't playing nicely with how commands are executed in Go. In that example gist, using ls works just fine.

@GideonWolfe
Copy link
Author

GideonWolfe commented Jun 1, 2020

Here is the entirety of my script

#!/bin/bash
curl -s "http://jellyfin.domain/Sessions?api_key=API_KEY" | jq -r '.[] | .RemoteEndPoint' | iponmap

Which essentially pipes a list of IPs

192.364.3.65
546.767.45.3
23.545.6.45

to iponmap. (these are random IP, they don't work)

@Seanstoppable
Copy link
Collaborator

iponmap seems to be due to the library used to render it.
https://github.com/chjj/blessed is an widget api, of which programs can be interactive.
Just using the hello world example from the repo, I get the same behavior.
You'll notice that on quitting, you drop back into your terminal as is, so it doesn't look like it is exporting content such that another app can grab it, like other scripts which are spitting out data to the terminal.

@GideonWolfe
Copy link
Author

Ah, unfortunate in both cases then. Thanks for looking into it guys!

@senorprogrammer
Copy link
Collaborator

Thanks for that info @Seanstoppable, that's extremely helpful. And you're welcome @GideonWolfe , should you have any other issues, don't hesitate to ask. You bringing this up has shown me that I should provide some documentation on possible limitations of the command runner.

@tnwei
Copy link

tnwei commented Aug 23, 2021

Adding to this issue for posterity. Recently got "exit status 2" from using CmdRunner to run a Python script which prints to std out no problem when ran in terminal. I initially specified the file path relative to home dir using "~", changing to absolute file path got it to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants