Github user jvwing commented on the pull request:

    https://github.com/apache/nifi/pull/218#issuecomment-195858721
  
    I have a [suggested fix/hack for dealing with spaces in the Java path in 
env-nifi.bat](https://github.com/jvwing/nifi/commit/2094080675d0d976fd4cd883d9f97cd10994ba69)).
  The fix converts the TOOLS_JAR path into a short 8.3 path without spaces, so 
the eventual call to NiFi has only one quoted parameter.  The expanded 
TOOLS_JAR path was not working due to spaces, and two quoted paths make the 
whole thing blow up for reasons I do not comprehend.
    
    However, this was not enough to get the env feature running on Windows 10.  
Running it outputs 
    
    ```
    17:58:32.959 [main] DEBUG o.a.n.b.NotificationServiceManager - Found 0 
service elements
    17:58:32.963 [main] INFO  o.a.n.b.NotificationServiceManager - Successfully 
loaded the following 0 services: []
    17:58:32.965 [main] INFO  org.apache.nifi.bootstrap.RunNiFi - Registered no 
Notification Services for Notification Type NIFI_STARTED
    17:58:32.987 [main] INFO  org.apache.nifi.bootstrap.RunNiFi - Registered no 
Notification Services for Notification Type NIFI_STOPPED
    17:58:32.989 [main] INFO  org.apache.nifi.bootstrap.RunNiFi - Registered no 
Notification Services for Notification Type NIFI_DIED
    17:58:33.012 [main] DEBUG org.apache.nifi.bootstrap.Command - Status File: 
bin\nifi.pid
    17:58:33.013 [main] DEBUG org.apache.nifi.bootstrap.Command - Status File: 
bin\nifi.pid
    17:58:33.040 [main] DEBUG org.apache.nifi.bootstrap.Command - Properties: 
{port=40930}
    17:58:33.041 [main] DEBUG org.apache.nifi.bootstrap.Command - Pinging 40930
    17:58:33.078 [main] DEBUG org.apache.nifi.bootstrap.Command - Sent PING 
command
    17:58:33.080 [main] DEBUG org.apache.nifi.bootstrap.Command - PING 
response: PING
    17:58:33.081 [main] INFO  org.apache.nifi.bootstrap.Command - Apache NiFi 
is not running
    ```
    
    Where the last line "Apache NiFi is not running" matches RunNiFi.java line 
559, where the env() method quits after not finding a PID.  Yes, NiFi was 
running when I tested this.  In comparison, the `status-nifi.bat` outputs
    
    ```
    17:49:49.660 [main] DEBUG o.a.n.b.NotificationServiceManager - Found 0 
service elements
    17:49:49.664 [main] INFO  o.a.n.b.NotificationServiceManager - Successfully 
loaded the following 0 services: []
    17:49:49.666 [main] INFO  org.apache.nifi.bootstrap.RunNiFi - Registered no 
Notification Services for Notification Type NIFI_STARTED
    17:49:49.690 [main] INFO  org.apache.nifi.bootstrap.RunNiFi - Registered no 
Notification Services for Notification Type NIFI_STOPPED
    17:49:49.691 [main] INFO  org.apache.nifi.bootstrap.RunNiFi - Registered no 
Notification Services for Notification Type NIFI_DIED
    17:49:49.719 [main] DEBUG org.apache.nifi.bootstrap.Command - Status File: 
bin\nifi.pid
    17:49:49.723 [main] DEBUG org.apache.nifi.bootstrap.Command - Status File: 
bin\nifi.pid
    17:49:49.749 [main] DEBUG org.apache.nifi.bootstrap.Command - Properties: 
{port=40930}
    17:49:49.752 [main] DEBUG org.apache.nifi.bootstrap.Command - Pinging 40930
    17:49:49.798 [main] DEBUG org.apache.nifi.bootstrap.Command - Sent PING 
command
    17:49:49.801 [main] DEBUG org.apache.nifi.bootstrap.Command - PING 
response: PING
    17:49:49.804 [main] INFO  org.apache.nifi.bootstrap.Command - Apache NiFi 
is currently running, listening to Bootstrap on port 40930, PID=unknkown
    ```
    
    Which recognizes that NiFi is running based on `isRespondingToPing()` (line 
532), and describes the PID as "unknkown".  Since it looks like you use the PID 
in the env method, I'm not immediately sure what to suggest next.  It might be 
possible to work out an "if Windows, do this to get the PID" flow.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to